package com.lucnn.diamond.spring.config;

import com.lucnn.diamond.spring.bean.Person;
import com.lucnn.diamond.spring.condition.MacCondition;
import com.lucnn.diamond.spring.condition.WinCondition;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Conditional;
import org.springframework.context.annotation.Configuration;

@Configuration
public class ScopeConfig {

    //@Lazy 只对单实例Bean生效，
//    @Scope("prototype")
//    @Bean
    public Person person(){
        System.out.println("person init");
        return new Person(18,"luxy");
    }

    @Conditional(MacCondition.class)
    @Bean
    public Person person01(){
        return new Person(50,"Linus");
    }

    @Conditional(WinCondition.class)
    @Bean
    public Person person02(){
        return new Person(40,"Bill Gates");
    }
}
